#include "filemanage.h"
#include "qdebug.h"

fileManage::fileManage()
{

}


fileManage* fileManage::_instance = 0;

/**
 * @brief fileManage::Instance 单例获取函数
 * @return 单例句柄
 */
fileManage *fileManage::Instance()
{
    if(_instance == 0) {
        _instance = new fileManage;
    }
    return _instance;
}

/**
 * @brief fileManage_load_file 加载文件
 */
void fileManage::fileManage_load_file(QString path)
{
/*
 * QFile file(filename);
    if (!file.open(QIODevice::ReadWrite | QIODevice::Text))
        return;

    QTextStream in(&file);
    QString line =  in.readAll();
    process_line(line);
 */

    file = new QFile(path);
    if (!file->open(QIODevice::ReadWrite | QIODevice::Text)) {
        qDebug() << "filemanage_line_41_open_failed";
        return;
    }

    in = new QTextStream(file);

    QString line =  in->readAll();
    process_line(line);
}

void fileManage::process_line(QString line)
{
    qDebug() << line;
}
